import http from "@/api";
import { PORT1 } from "@/api/config/servicePort";
import qs from "qs";
import { Login } from "@/api/interface/index";
export const apiArticleEdit = () => { return http.get<any>(PORT1 + `user/getCollege`) };
// 请求这周空闲时间数据
export const apiThisWeekFreetime = () => { return http.get<any>(PORT1 + `/userdaily/thisWeekIdletime`) };
// 请求下周空闲时间数据
export const apiNextWeekFreetime = () => { return http.get<any>(PORT1 + `/userdaily/nextWeekIdletime`) };
//  请求更新空闲时间
export const upDateFreeTime = (params:any) => { return http.post<any>(PORT1 + `/userdaily/updateIdletime`,params) }
// 请求个人信息数据
export const apiUserSetting = () => { return http.post<any>(PORT1 + `/user/getUser`) }
// 请求学校
export const apiCollege = () => { return http.get<any>(PORT1 + `/user/getCollege`) }
// 请求修改个人信息
export const changeUserSetting = (parms: any) => {
    return http.post<any>(PORT1 + '/user/updateUserInfo', parms);
}
//统计信息
export const apiDataVisualize = () => { return http.get<any>(PORT1 + `/getStatisticsInformations`) };
// 请求修改密码
export const changePassword = (parms: any) => {
    return http.post<any>(PORT1 + '/user/updatePwd', qs.stringify(parms));
}
// 请求登录
export const loginApi = (params: Login.ReqLoginForm) => {
    return http.post<Login.ResLogin>(PORT1 + `/user/login`, qs.stringify(params));
    // return http.post<Login.ResLogin>(PORT1 + `/user/login`, {}, { params }); // post 请求携带 query 参数  ==>  ?username=admin&password=123456
    // return http.post<Login.ResLogin>(PORT1 + `/user/login`, params);
}
//日报相关接口
export const addDayReportApi = (parms:any)=>{
    return http.post<any>(PORT1 + '/dailyReport/addDailyReport',parms);
}
export const getAllDayReportApi = (parms:any)=>{
    return http.post<any>(PORT1 + '/dailyReport/getDailyReport',parms);
}
export const getDayReportByIdApi = (parms:any)=>{
    return http.post<any>(PORT1 + '/dailyReport/getDailyReportByReportId',parms);
}
export const getDayReportByTimeApi = (parms:any)=>{
    return http.post<any>(PORT1 + '/dailyReport/getDailyReportByTime',parms);
}

//周报相关接口
export const addWeekReportApi = (parms:any)=>{
    return http.post<any>(PORT1 + '/weeklyReport/addWeeklyReport',parms);
}
export const getAllWeekReportApi = (parms:any)=>{
    return http.post<any>(PORT1 + '/weeklyReport/getWeeklyReport',parms);
}
export const getWeekReportByIdApi = (parms:any)=>{
    return http.post<any>(PORT1 + '/dailyReport/getDailyReportByReportId',parms);
}
export const getWeekReportByTimeApi = (parms:any)=>{
    return http.post<any>(PORT1 + '/dailyReport/getDailyReportByTime',parms);
}
export const apiParticipationCourse = (url: string) => { return http.get<any>(PORT1 + url) };
export const apiCourse = (url:string, id:number) => {
  
     return http.get<any>(PORT1 + url+`?classification=${id}`);
};
export  const apiRecord=() => { return http.get<any>(PORT1 + `/getClockInfo`) };
